﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using QLST_BUS;
using System.Data.SqlClient;

namespace QLST_CoopMart_GoVap
{
    public partial class ucMain_NhanVienPP : UserControl
    {
        //DataProvider dap = new DataProvider();
        NHANVIENBUS NVBUS = new NHANVIENBUS();
        public ucMain_NhanVienPP()
        {
            InitializeComponent();
        }
        public DataTable GetQuayhang()
        {
            DataTable tbl = new DataTable();
           // tbl = dap.ExcuteProcedureGetTable("st_QuayHang", null);
            return tbl;
        }

        public void LoadSanPhamChon()
        {
            SqlParameter[] parameters = new SqlParameter[1];
            parameters[0] = new SqlParameter("@MaLoai", 1);
            DataTable tbl = new DataTable();
            //tbl = dap.ExcuteProcedureGetTable("st_GetHangHoa", parameters);
            dgvChonSanPham.DataSource = tbl;
        }

        public void LoadQuayHang(DataTable tblQuayHang)
        {

            lvQuayHang.Items.Clear();

            int irow = 0;

            foreach (DataRow dr in tblQuayHang.Rows)
            {
                ListViewItem item = new ListViewItem("Quầy " + dr[0].ToString() + "\nCó " +  dr["SoLuongSP"].ToString() + " sản phẩm" );
                item.SubItems.Add(dr[1].ToString());
                item.SubItems.Add(dr[2].ToString());
                item.SubItems.Add(dr[3].ToString());
                item.SubItems.Add(dr[4].ToString());
                item.ImageIndex = 0;
                lvQuayHang.Items.Add(item);
                irow++;
            }
        }

        private void ucMain_NhanVienPP_Load(object sender, EventArgs e)
        {
            DataTable tbl = GetQuayhang();
            LoadQuayHang(tbl);
            LoadSanPhamChon();
        }
    }
}
